/*
 * @Description:
 * @Version: 2.0
 * @Autor: snzo.chen
 * @Date: 2023-11-28 17:14:22
 * @LastEditors: snzo.chen
 * @LastEditTime: 2023-11-30 10:51:16
 */
import { request } from '@/utils/request';

/**
 * 查询所有用户
 * @param params
 * @returns
 */
export function selectAllPerson(params: API.PageParams) {
  return request<API.SeachResult>(
    {
      url: '/person/selectAll',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: true,
    },
  );
}

/**
 * 按ID 查找用户
 * @param params
 * @returns
 */
export function selectPersonById(params: API.UserItem) {
  return request<API.SeachResult>(
    {
      url: '/person/selectById',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: true,
    },
  );
}

/**
 * 按条件查询
 * @param data
 * @param params
 * @returns
 */
export function selectPersonByExample(data: API.UserItem, params: API.PageParams) {
  return request<API.SeachResult<API.UserItem[]>>(
    {
      url: '/person/selectByExample',
      method: 'post',
      data,
      params,
    },
    {
      isGetDataDirectly: true,
    },
  );
}

/**
 * 添加用户
 * @param params
 * @returns
 */
export function insertTicketPerson(data: API.UserItem) {
  return request<API.BaseResult>(
    {
      url: '/person/insertTicketPerson',
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: true,
    },
  );
}

/**
 * 更新用户
 * @param params
 * @returns
 */
export function updateTicketPerson(data: API.UserItem) {
  return request<API.BaseResult>(
    {
      url: '/person/updateTicketPerson',
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: true,
    },
  );
}

/**
 * 删除用户
 * @param data
 * @returns
 */
export function deleteTicketPerson(data: API.UserItem) {
  return request<API.BaseResult>(
    {
      url: '/person/deleteTicketPerson',
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: true,
    },
  );
}
